//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	MetaFormButtonGroup.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System;
using System.Linq;

namespace Smart.Common.Forms
{
	/// <summary>
	/// Forms buttons group
	/// </summary>
	public class MetaFormButtonGroup : MetaFormContainer<MetaFormButton>
	{
		/// <summary>
		/// Buttons group buttons template
		/// </summary>
		public MetaButtonGroupTemplate Template { get; set; }

		/// <summary>
		/// Security
		/// </summary>
		public string[] Security { get; set; }

		/// <summary>
		/// Condition
		/// </summary>
		public string Condition { get; set; }

		/// <summary>
		/// Forms button group
		/// </summary>
		public MetaFormButtonGroup(string title, string name, MetaButtonGroupTemplate template)
			: base(title, name)
		{
			Template = template;
		}

		/// <summary>
		/// Set security
		/// </summary>
		/// <param name="security">;# splitted string of security</param>
		public virtual void SetSecurity(string security)
		{
			Security = security.SplitAndTrimByCommaOrSemicolonOrLookup();
		}
	}
}